package chapter19;

import java.util.EnumMap;
import java.util.Map;

enum AlarmPoints {
    /**
     *
     */
    STAIR1, STAIR2, LOBBY, OFFICE1, OFFICE2, OFFICE3,
    OFFICE4, BATHROOM, UTILITY, KITCHEN
}

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/1/19 9:48
 */
interface Command {
    /**
     * Action for command
     */
    void action();
}

public class EnumMaps {
    public static void main(String[] args) {
        EnumMap<AlarmPoints, Command> enumMap = new EnumMap<>(AlarmPoints.class);

        enumMap.put(AlarmPoints.STAIR1, () -> System.out.println("Stair1 fire!"));
        enumMap.put(AlarmPoints.OFFICE1, () -> System.out.println("OFFICE1 fire!"));
        enumMap.put(AlarmPoints.KITCHEN, () -> System.out.println("KITCHEN fire!"));

        for (Map.Entry<AlarmPoints, Command> entry : enumMap.entrySet()) {
            System.out.println(entry.getKey() + ":" + entry.getValue());
            entry.getValue().action();
        }
    }
}
